traverse: Require variant when traversing dirtree
authorDan Nicholson <nicholson@endlessm.com>
Wed, 23 Mar 2016 16:32:29 +0000 (09:32 -0700)
committerColin Walters <walters@verbum.org>
Wed, 23 Mar 2016 19:36:04 +0000 (15:36 -0400)
The dirtree object is required for traversing, so don't use the
load_variant_if_exists() function. This will return a
G_IO_ERROR_NOT_FOUND to the caller rather than trying to ref a NULL
variant in ostree_repo_commit_traverse_iter_init_dirtree() if the object
is missing.

https://bugzilla.gnome.org/show_bug.cgi?id=764091

src/libostree/ostree-repo-traverse.c

index 85ce317d6741f039cd18df9234ab3d6d7c57f7b8..97bd102338fe39da2f8f620aef73f0e29bde9052 100644 (file)
@@ -377,9 +377,8 @@ traverse_dirtree (OstreeRepo           *repo,
   ostree_cleanup_repo_commit_traverse_iter
     OstreeRepoCommitTraverseIter iter = { 0, };
 
-  if (!ostree_repo_load_variant_if_exists (repo, OSTREE_OBJECT_TYPE_DIR_TREE,
-                                           checksum, &dirtree,
-                                           error))
+  if (!ostree_repo_load_variant (repo, OSTREE_OBJECT_TYPE_DIR_TREE, checksum,
+                                 &dirtree, error))
     goto out;
 
   if (!ostree_repo_commit_traverse_iter_init_dirtree (&iter, repo, dirtree,